﻿using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WatchExeRun.Model
{
    public class MainModel : ObservableObject
    {
        //程序名称
        private string programName = "";
        public string ProgramName
        {
            get { return programName; }
            set
            {
                programName = value;
                RaisePropertyChanged(() => ProgramName);
            }
        }

        //程序路径
        private string programPath = "";
        public string ProgramPath
        {
            get { return programPath; }
            set
            {
                programPath = value;
                RaisePropertyChanged(() => ProgramPath);
            }
        }

        //进程名
        private string processName = "";
        public string ProcessName
        {
            get { return processName; }
            set
            {
                processName = value;
                RaisePropertyChanged(() => ProcessName);
            }
        }

        // 是否开机自启
        private bool isAutoStartupSelf = false;
        public bool IsAutoStartupSelf
        {
            get { return isAutoStartupSelf; }
            set
            {
                isAutoStartupSelf = value;
                RaisePropertyChanged(()=> IsAutoStartupSelf);
            }
        }

        // 是否程序打开自动监听
        private bool isAutoWatch = false;
        public bool IsAutoWatch
        {
            get { return isAutoWatch; }
            set
            {
                isAutoWatch = value;
                RaisePropertyChanged(() => IsAutoWatch);
            }
        }

        //监听间隔,秒
        private int watchInterval = 15;
        public int WatchInterval
        {
            get { return watchInterval; }
            set
            {
                watchInterval = value;
                RaisePropertyChanged(() => WatchInterval);
            }
        }

        //监听状态
        private bool isWatchStatus = false;
        public bool IsWatchStatus
        {
            get { return isWatchStatus; }
            set
            {
                isWatchStatus = value;
                RaisePropertyChanged(() => IsWatchStatus);
            }
        }

        //监听状态
        private string watchStatus = "监听关闭中";
        public string WatchStatus
        {
            get { return watchStatus; }
            set
            {
                watchStatus = value;
                RaisePropertyChanged(() => WatchStatus);
            }
        }

        //日志
        private string logText = "";
        public string LogText
        {
            get { return logText; }
            set
            {
                logText += string.IsNullOrWhiteSpace(value) ? value : $@"{DateTime.Now.ToString()}：{value}" + Environment.NewLine;
                RaisePropertyChanged(() => LogText);
            }
        }



    }
}
